package kr.hkit.androidcomplete01.ch12;

import java.util.ArrayList;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class ListOnly extends ListActivity {
	ArrayList<String> arGeneral;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		arGeneral = new ArrayList<String>();
		arGeneral.add("김유신");
		arGeneral.add("이순신");
		arGeneral.add("강감찬");
		arGeneral.add("을지문덕");
		
		ArrayAdapter<String> Adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,arGeneral);
		setListAdapter(Adapter);
	}
	
	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		String mes;
		mes = "Selct Item = " + arGeneral.get(position);
		Toast.makeText(ListOnly.this, mes, Toast.LENGTH_LONG).show();
	}
}
